1c480b91454f47141b78980e21219138a752d368,src/main/java/org/restheart/handlers/injectors/BodyInjectorHandler.java,BodyInjectorHandler,handleRequest,#HttpServerExchange#RequestContext#,99

Before Change


                filterJsonContent(_content, context);
            }

            context.setContent(content);
        }

        getNext()

After Change


                    return;
                }
            } else {
                content = null;
            }
        }

        if (content == null) {
            content = new BsonDocument();
        } else if (content.isArray()) {
            content.asArray().stream().forEach(_doc -> {
                if (_doc.isDocument()) {
                    BsonValue _id = _doc.asDocument().get(_ID);

                    try {
                        checkIdType(_doc.asDocument());
                    } catch (UnsupportedDocumentIdException udie) {
                        String errMsg = "the type of _id in content body"
                                + " is not supported: "
                                + (_id == null
                                        ? ""
                                        : _id.getBsonType().name());

                        ResponseHelper.endExchangeWithMessage(
                                exchange,
                                HttpStatus.SC_NOT_ACCEPTABLE,
                                errMsg,
                                udie);

                        return;
                    }

                    filterJsonContent(_doc.asDocument(), context);
                } else {
                    String errMsg = "the content must be either "
                            + "an json object or an array of objects";

                    ResponseHelper.endExchangeWithMessage(
                            exchange,
                            HttpStatus.SC_NOT_ACCEPTABLE,
                            errMsg);
                }
            });
        } else if (content.isDocument()) {
            BsonDocument _content = content.asDocument();

            BsonValue _id = _content.get(_ID);

            try {
                checkIdType(_content);
            } catch (UnsupportedDocumentIdException udie) {
                String errMsg = "the type of _id in content body "
                        + "is not supported: "
                        + (_id == null
                                ? ""
                                : _id.getBsonType().name());

                ResponseHelper.endExchangeWithMessage(
                        exchange,
                        HttpStatus.SC_NOT_ACCEPTABLE,
                        errMsg,
                        udie);
                return;
            }

            filterJsonContent(_content, context);
        }

        context.setContent(content);

        getNext()
                .handleRequest(exchange, context);